package com.course.web.view;

import com.course.web.component.custom.StudentGrid;
import com.course.web.page.AdminUI;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.spring.annotation.SpringView;
import com.vaadin.ui.CustomComponent;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by Justin on 2017/5/14.
 */
@SpringView(name = StudentListView.NAME, ui = AdminUI.class)
public class StudentListView extends CustomComponent implements View {
    public static final String NAME = "student-list";

    private final StudentGrid studentGrid;

    @Autowired
    public StudentListView(StudentGrid studentGrid) {
        this.studentGrid = studentGrid;
        setCompositionRoot(studentGrid);
        setSizeFull();
    }

    @Override
    public void enter(ViewChangeListener.ViewChangeEvent event) {
        studentGrid.enter();
    }
}
